﻿<telerik:RadWindow x:Name="radWindow" 
                   x:Class="Rio.Framework.Pages.ChildWindows.BarcodeResultChildWindow"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    mc:Ignorable="d"
                    ResizeMode="CanResize"  CanClose="True" CanMove="true" WindowStartupLocation="CenterScreen"
                    Width="600"
                    Height="500"
                    xmlns:Converter="clr-namespace:Rio.Framework.Pages.Helpers"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  
                    KeyUp="radWindow_KeyUp"           
                    d:DesignHeight="400" d:DesignWidth="450" Loaded="RadWindow_Loaded">

    <telerik:RadWindow.Resources>

        <Converter:PathFileToFileNameConverterWithoutExtension x:Key="PathFileToFileNameConverterWithoutExtension" />

        <!--Images-->
        <telerik:HierarchicalDataTemplate x:Key="Image">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name, Converter={StaticResource PathFileToFileNameConverterWithoutExtension}}" Foreground="Black" />
            </StackPanel>
        </telerik:HierarchicalDataTemplate>

        <!--Document-->
        <telerik:HierarchicalDataTemplate x:Key="Document" ItemTemplate="{StaticResource Image}"
				ItemsSource="{Binding ImagesToIndex}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Assets/Images/FolderCloseBlue.png"
                                   Width="12"
                                   Height="12"
                                   Margin="2,2,2,2" />
                <TextBlock Text="{Binding Name}" FontSize="11" Foreground="Black" FontWeight="Bold" />
            </StackPanel>
        </telerik:HierarchicalDataTemplate>

        <!--Folders-->
        <telerik:HierarchicalDataTemplate x:Key="Folders" ItemTemplate="{StaticResource Document}"
				ItemsSource="{Binding Documents}">
            <StackPanel Orientation="Horizontal">
                <Image Source="../Assets/Images/Folder.png"
                                   Width="12"
                                   Height="12"
                                   Margin="2,2,2,2" />
                <TextBlock Text="{Binding Name}" FontSize="11" Foreground="Black" FontWeight="Bold"  />
            </StackPanel>
        </telerik:HierarchicalDataTemplate>


    </telerik:RadWindow.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>

        <ScrollViewer Grid.Row="0">
            <telerik:RadTreeView x:Name="TreeView"
                                 ItemPrepared="TreeView_ItemPrepared"
                                 IsRootLinesEnabled="True"
                                 IsDragDropEnabled="False"
                                 IsEditable="False"
                                 IsExpandOnSingleClickEnabled="True"
                                 IsLineEnabled="True"
                                 ItemTemplate="{StaticResource Folders}"
                                 ItemsSource="{Binding Folders, ElementName=radWindow}"/>              
        </ScrollViewer>

        <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="16,10,10,5" Grid.Column="1" d:LayoutOverrides="Width" HorizontalAlignment="Right" VerticalAlignment="Bottom">
            <telerik:RadButton x:Name="OkBtn" MinWidth="70" VerticalAlignment="Center" Margin="10 0 0 0" Click="OkBtn_Click">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16"
                           Height="16"
                           Margin="0,0,2,0"
                           Source="../../Assets/Images/Validate.png" />
                    <TextBlock x:Name="TextBlockToIndex"
                               VerticalAlignment="Center" />
                </StackPanel>
            </telerik:RadButton>
            <telerik:RadButton x:Name="CancelBtn" Content="Annuler" MinWidth="70" VerticalAlignment="Center" Margin="10 0 0 0" Click="CancelBtn_Click"/>
        </StackPanel>
    </Grid>
</telerik:RadWindow>
